<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="last-modified" content="2016-06-22">
  <title>Install notes for the ArcGIS API for JavaScript Library (Windows)</title>
</head>
<body>

<h1 style="border-bottom: #dcdcdc 1px solid;">Install notes for the ArcGIS API for JavaScript&#153;</h1>

<h2>Installing the ArcGIS API for JavaScript Library on Windows</h2>

<p>The instructions below assume that you are installing the ArcGIS JavaScript API library in the following location on
    an IIS Web Server, "http://&lt;myserver&gt;/arcgis_js_api/library/3.17/" where &lt;myserver&gt; is the domain name of your Web site.  After copying files to your Web server, you will need to edit some files to include the URL to the server and directory that you are planning to install to.</p>

<p>For instructions on deploying the library on Linux/Unix, please go to the <a href="install_linux.html">installation notes for Linux/Unix</a>.</p>

<ol>
    <li>Copy <code>\arcgis_js_api\library</code> and all its contents from the zip file to your Web server.  In this example the files are copied to:<br/>
        <code>C:\Inetpub\wwwroot\arcgis_js_api\library</code>
    </li>
</ol>

<h3>Install the Normal or Compact Build</h3>

<p>ArcGIS JSAPI 3.17 contains two builds--a normal build and a compact build.  The compact build removes the Dojo Dijit dependancy and minimizes the non-essential ArcGIS JSAPI classes.  Please see the <a href='../../sdk/jshelp/intro_accessapi.html#compact-build'>documentation</a> for more details.</p>

<p>Your directions may differ depending on your server configuration or Web server, but the process is the same.</p>

<b>Configuration options for normal build:</b>
<ol>
    <li>Open <code>C:\Inetpub\wwwroot\arcgis_js_api\library\3.17\3.17\init.js</code> in a text editor and search for the text <code>'[HOSTNAME_AND_PATH_TO_JSAPI]'</code>, and replace this text with <code>"&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17/"</code></li>
    <li>Open <code>C:\Inetpub\wwwroot\arcgis_js_api\library\3.17\3.17\dojo\dojo.js</code> in a text editor and search for the text <code>'[HOSTNAME_AND_PATH_TO_JSAPI]'</code>, and replace this text with <code>"&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17/"</code></li>
</ol>

<b>Configuration options for compact build:</b>
<ol>
    <li>Open <code>C:\Inetpub\wwwroot\arcgis_js_api\library\3.17\3.17compact\init.js</code> in a text editor and search for the text <code>'[HOSTNAME_AND_PATH_TO_JSAPI]'</code>, and replace each instance of this text with <code>"&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17compact/"</code></li>
    <li>Open <code>C:\Inetpub\wwwroot\arcgis_js_api\library\3.17\3.17compact\dojo\dojo.js</code> in a text editor and search for the text <code>'[HOSTNAME_AND_PATH_TO_JSAPI]'</code>, and replace this text with <code>"&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17compact/"</code></li>
</ol>

   <h3>Using HTTP/HTTPS with different ports</h3>

   <p>The steps below outline what to do if accessing non-default (80/443) HTTP/HTTPS ports in a single local API install. </br></br>
Assuming <code>init.js</code> is accessible at the following URL: <code>http://xyz.company.com/jsapi/init.js</code> and the web server uses a non-standard port for HTTPS, the <code>baseUrl</code> value below would work:
<ol>
   <li>
      <div style="background-color: #E5EFF7;">
     <pre>
baseUrl: (location.protocol === "file:" ? "http:" : location.protocol)
+ "//" + "xyz.company.com:" + (location.protocol === "https:" ? 8443 : 9090) + "/jsapi/dojo"
     </pre>
      </div>
Assume that HTTP port = 9090 and HTTPS port = 8443. Replace
      <div style="background-color: #E5EFF7;">
 <pre>
"[HOSTNAME_AND_PATH_TO_JSAPI]/dojo"
     </pre>
  </div>
   with
   <div style="background-color: #E5EFF7;">
 <pre>
"xyz.company.com:" + (location.protocol === "https:" ? "8443" : "9090") + "/jsapi/dojo"
     </pre>
  </div>
      </div>
   <p>If the HTTP port is standard 80, but HTTPS port is non-standard.</p>
  </li>
   <li>
 <div style="background-color: #E5EFF7;">
 <pre>
"xyz.company.com:" + (location.protocol === "https:" ? "8443" : "") + "/jsapi/dojo"
     </pre>
  </div>
      </li>
</ol>
</p>

<h3>Test the Install</h3>

<p>Now you should be able to access the ArcGIS JavaScript library from your Web server using the following URL(s):</p>

<pre>
    http://&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17/init.js
    http://&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17compact/init.js</pre>

<p>Test your install.  You can use the following test code to validate your JSAPI library install.</p>

<div style="background-color: #E5EFF7;">
  <pre>
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
    &lt;title&gt;Simple Map&lt;/title&gt;
    &lt;link rel="stylesheet" type="text/css" href="http://&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17/dijit/themes/tundra/tundra.css"/&gt;
    &lt;link rel="stylesheet" type="text/css" href="http://&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17/esri/css/esri.css" /&gt;
    &lt;script type="text/javascript" src="http://&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17/init.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;
      dojo.require("esri.map");
      function init() {
        var myMap = new esri.Map("mapDiv");
        //note that if you do not have public Internet access then you will need to point this url to your own locally accessible cached service.
        var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer");
        myMap.addLayer(myTiledMapServiceLayer);
      }
      dojo.addOnLoad(init);
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body class="tundra"&gt;
    &lt;div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"&gt;&lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
</div>

<h2>Change the ArcGIS Services Directory &quot;View In JavaScript&quot; URL</h2>

<p> The Services Directory allows you to view Map and Image services using the JavaScript API. Set the following values in the rest-config.properties file to use the local install:</p>

<pre>
#JS API URLs
jsapi.arcgis=http://&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17/
jsapi.arcgis.sdk=http://&lt;myserver&gt;/arcgis_js_sdk/sdk/
jsapi.arcgis.css=http://&lt;myserver&gt;/arcgis_js_api/library/3.17/3.17/dijit/themes/tundra/tundra.css
</pre>

<p>Finally make sure the import statement for the <code>esri.css</code> stylesheet is in the &lt;ArcGIS Server Install Location&gt;ArcGIS\Server\framework\runtime\tomcat\webapps\arcgis#rest\www\client\mapserver\mapserverJSAPI.jsp file.</p>

<pre>&lt;style&gt;
@import "&lt;%=jsapiArcgisCssUrl%&gt;";
@import "&lt;%=cpath%&gt;/static/jsapi.css";
@import "&lt;%=jsapiArcgisUrl%&gt;/js/esri/css/esri.css";
&lt;/style&gt;</pre>

<p>View the <a href="http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#//02r3000000pw000000">Configuring the Rest API</a> help topic for more details. </p>

</body>
</html>